#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/**
 * @brief 
 * 移动指针，跳过需要移除的元素
 * @param nums 
 * @param numsSize 
 * @param val 
 * @return int 
 */
int removeElement(int* nums, int numsSize, int val){
    int j = 0;
    for (int i = 0; i < numsSize; i++)
    {
        if (nums[i] != val)
        {
            nums[j++] = nums[i];
        }
    }
    return j;
}


int main(void)
{
    int nums[] = {0,0,1,1,1,2,2,3,3,4};
    int result = removeElement(nums,10,1);
    for (size_t i = 0; i < 10; i++)
    {
        printf("%d ",nums[i]);
    }
    printf("\n %d \n",result); 
    return 0;
}